package com.whz.method;

import java.util.Date;

/**
 * @Author: sinosoft
 * @Description:
 * @Date: Create in 12:38 2021/5/19
 * @Modified By:
 */
public final class Period {
    private final Date start;
    private final Date end;

    public Period(Date start, Date end) {
        if(start.compareTo(end) > 0) {
            throw new IllegalArgumentException("开始时间: " + start + "在结束时间之后: " + end);
        }
        this.start = start;
        this.end = end;
    }

    public Date start() {
        return start;
    }


    public Date end() {
        return end;
    }

    @Override
    public String toString() {
        return "Period{" +
                "开始时间=" + start +
                ", 结束时间=" + end +
                '}';
    }
}
